<!DOCTYPE html>
<html lang="zh-CN">
	<head>
		<meta charset="UTF-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<title>选择更大的片段</title>
	</head>
	<body>
		<p id="p">Example: <i>italic</i> and <b>bold</b></p>

		<script>
			let range = new Range()

			// p.firstChild 是 Example:（文本节点）
			range.setStart(p.firstChild, 2)
			b.setEnd(p.querySelector('b').firstChild, 2)

			console.log(range.toString())

			window.getSelection().addRange(range)
		</script>
	</body>
</html>
